Remove use of get_gendisk in blkfront gen_gendisk is no long exported
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 9 Nov 2005 13:41:14 +0000 (14:41 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 9 Nov 2005 13:41:14 +0000 (14:41 +0100)
by 2.6 kernel. Now blkfront can be built as a kernel module.

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
Signed-off-by: Jeremy Katz <katzj@redhat.com>
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
linux-2.6-xen-sparse/drivers/xen/blkfront/block.h
linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c

index 70d9e0ba7d5ca58d50a009562feb55bcc791d63d..c47b053b986ee01db1911ff36c6ec9f5b387a598 100644 (file)
@@ -641,6 +641,7 @@ static int blkfront_probe(struct xenbus_device *dev,
        info->vdevice = vdevice;
        info->connected = BLKIF_STATE_DISCONNECTED;
        info->mi = NULL;
+       info->gd = NULL;
        INIT_WORK(&info->work, blkif_restart_queue, (void *)info);
 
        info->shadow_free = 0;
index 24388e84e59dd088a2da9f86153033127d1161cc..c3149f5deea0b3f46058a62615c83ca6e4ebfcd3 100644 (file)
@@ -116,6 +116,7 @@ struct blkfront_info
        /* We watch the backend */
        struct xenbus_watch watch;
        dev_t dev;
+       struct gendisk *gd;
        int vdevice;
        blkif_vdev_t handle;
        int connected;
index 49a6ab488279c90ce3d8bea2d4af3bf49b5742f0..fdc78c315f4ae0a22600393a2fc15748d0c659bd 100644 (file)
@@ -259,6 +259,7 @@ xlvbd_alloc_gendisk(int minor, blkif_sector_t capacity, int vdevice,
                gd->flags |= GENHD_FL_CD;
 
        add_disk(gd);
+       info->gd = gd;
 
        return 0;
 
@@ -292,22 +293,19 @@ void
 xlvbd_del(struct blkfront_info *info)
 {
        struct block_device *bd;
-       struct gendisk *gd;
-       int unused;
-       request_queue_t *rq;
 
        bd = bdget(info->dev);
        if (bd == NULL)
                return;
 
-       gd = get_gendisk(info->dev, &unused);
-       rq = gd->queue;
+       if (info->gd == NULL)
+               return;
 
-       del_gendisk(gd);
-       put_disk(gd);
+       del_gendisk(info->gd);
+       put_disk(info->gd);
        xlbd_put_major_info(info->mi);
        info->mi = NULL;
-       blk_cleanup_queue(rq);
+       blk_cleanup_queue(info->rq);
 
        bdput(bd);
 }